
<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
      <link rel="icon" href="../../../../static/images/favicon.png">
      <meta name="generator" content="mkdocs-1.3.0, mkdocs-material-8.2.8">
    
    
      
        <title>JuiceFS 生产集群部署 - WL4G DOCS</title>
      
    
    
      <link rel="stylesheet" href="../../../../assets/stylesheets/main.644de097.min.css">
      
        
        <link rel="stylesheet" href="../../../../assets/stylesheets/palette.e6a45f82.min.css">
        
      
    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
      <link rel="stylesheet" href="../../../../static/css/util.css">
    
    <script>__md_scope=new URL("../../../..",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      

    
    
  </head>
  
  
    
    
      
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="" data-md-color-accent="">
  
    
    
      <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#juicefs" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
      <div data-md-component="outdated" hidden>
        <aside class="md-banner md-banner--warning">
          
        </aside>
      </div>
    
    
      

<header class="md-header" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="../../../.." title="WL4G DOCS" class="md-header__button md-logo" aria-label="WL4G DOCS" data-md-component="logo">
      
  <img src="../../../../static/images/mylogo.jpeg" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            WL4G DOCS
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              JuiceFS 生产集群部署
            
          </span>
        </div>
      </div>
    </div>
    
      <form class="md-header__option" data-md-component="palette">
        
          
          
          <input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="" data-md-color-accent=""  aria-label="Switch to dark mode"  type="radio" name="__palette" id="__palette_1">
          
            <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
            </label>
          
        
          
          
          <input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="" data-md-color-accent=""  aria-label="Switch to light mode"  type="radio" name="__palette" id="__palette_2">
          
            <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3z"/></svg>
            </label>
          
        
      </form>
    
    
      <div class="md-header__option">
        <div class="md-select">
          
          <button class="md-header__button md-icon" aria-label="Select language">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m12.87 15.07-2.54-2.51.03-.03A17.52 17.52 0 0 0 14.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04M18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12m-2.62 7 1.62-4.33L19.12 17h-3.24z"/></svg>
          </button>
          <div class="md-select__inner">
            <ul class="md-select__list">
              
                <li class="md-select__item">
                  <a href="/en/" hreflang="en" class="md-select__link">
                    English
                  </a>
                </li>
                
                <li class="md-select__item">
                  <a href="/zh/" hreflang="zh" class="md-select__link">
                    简体中文
                  </a>
                </li>
                
            </ul>
          </div>
        </div>
      </div>
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
        </button>
      </nav>
      
        <div class="md-search__suggest" data-md-component="search-suggest"></div>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
            
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
  <div class="md-tabs__inner md-grid">
    <ul class="md-tabs__list">
      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../../.." class="md-tabs__link">
        Getting Started
      </a>
    </li>
  

      
    </ul>
  </div>
</nav>
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

  


  

<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../../../.." title="WL4G DOCS" class="md-nav__button md-logo" aria-label="WL4G DOCS" data-md-component="logo">
      
  <img src="../../../../static/images/mylogo.jpeg" alt="logo">

    </a>
    WL4G DOCS
  </label>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_1" data-md-state="indeterminate" type="checkbox" id="__nav_1" checked>
      
      
      
      
        <label class="md-nav__link" for="__nav_1">
          Getting Started
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="Getting Started" data-md-level="1">
        <label class="md-nav__title" for="__nav_1">
          <span class="md-nav__icon md-icon"></span>
          Getting Started
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../.." class="md-nav__link">
        Introduction
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../../ABOUT_CN/" class="md-nav__link">
        About
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
          
          <div class="md-content" data-md-component="content">
            <article class="md-content__inner md-typeset">
              
                


<h1 id="juicefs">JuiceFS 生产集群部署<a class="headerlink" href="#juicefs" title="Permanent link">&para;</a></h1>
<ul>
<li>
<p><a href="https://github.com/juicedata/juicefs/releases">官方下载: github.com/juicedata/juicefs/releases</a></p>
</li>
<li>
<p><a href="https://github.com/juicedata/juicefs/blob/main/docs/en/quick_start_guide.md">官方文档: github.com/juicedata/juicefs/blob/main/docs/en/quick_start_guide.md</a></p>
</li>
<li>
<p><a href="https://juicefs.com/docs/zh/cloud/monitor#prometheus-api">官方监控: juicefs.com/docs/zh/cloud/monitor#prometheus-api</a></p>
</li>
<li>
<p><a href="https://juicefs.com/docs/zh/cloud/metadata_performance_comparison">官方压测: vs efs/goofys/hdfs/nfs - juicefs.com/docs/zh/cloud/metadata_performance_comparison</a></p>
</li>
</ul>
<h2 id="1-1-nas">1. 模式 1 - 客户端共享存储 (NAS)<a class="headerlink" href="#1-1-nas" title="Permanent link">&para;</a></h2>
<ul>
<li>集群拓扑</li>
</ul>
<table>
<thead>
<tr>
<th>IP</th>
<th>Description</th>
<th>Mount Point</th>
</tr>
</thead>
<tbody>
<tr>
<td>10.65.30.232</td>
<td>juicefs client (nas)</td>
<td>/mnt/disk1/jfs1 &nbsp;&nbsp; /mnt/disk1/jfs2</td>
</tr>
<tr>
<td>10.65.30.233</td>
<td>juicefs client (nas)</td>
<td>/mnt/disk1/jfs1 &nbsp;&nbsp; /mnt/disk1/jfs2</td>
</tr>
<tr>
<td>10.65.30.236</td>
<td>juicefs meta-server (redis:63791 / minio:9000)</td>
<td>---</td>
</tr>
</tbody>
</table>
<h3 id="11">1.1 依赖服务<a class="headerlink" href="#11" title="Permanent link">&para;</a></h3>
<p>这里选用 redis 作为元数据存储服务。</p>
<ul>
<li>快速 <a href="https://redis.io/">redis</a> 单机部署</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1"></a><a href="#__codelineno-0-1"><span class="linenos" data-linenos="1 "></span></a>mkdir -p /mnt/disk1/juicefs_redis
<a id="__codelineno-0-2" name="__codelineno-0-2"></a><a href="#__codelineno-0-2"><span class="linenos" data-linenos="2 "></span></a>d run -d --name juicefs_redis1 <span class="se">\</span>
<a id="__codelineno-0-3" name="__codelineno-0-3"></a><a href="#__codelineno-0-3"><span class="linenos" data-linenos="3 "></span></a>-v /mnt/disk1/juicefs_redis/:/data <span class="se">\</span>
<a id="__codelineno-0-4" name="__codelineno-0-4"></a><a href="#__codelineno-0-4"><span class="linenos" data-linenos="4 "></span></a>-p <span class="m">63791</span>:6379 <span class="se">\</span>
<a id="__codelineno-0-5" name="__codelineno-0-5"></a><a href="#__codelineno-0-5"><span class="linenos" data-linenos="5 "></span></a>--restart always <span class="se">\</span>
<a id="__codelineno-0-6" name="__codelineno-0-6"></a><a href="#__codelineno-0-6"><span class="linenos" data-linenos="6 "></span></a>redis:6.2.6 <span class="se">\</span>
<a id="__codelineno-0-7" name="__codelineno-0-7"></a><a href="#__codelineno-0-7"><span class="linenos" data-linenos="7 "></span></a>redis-server --appendonly yes
</code></pre></div>
<ul>
<li>快速 <a href="https://min.io/">MinIO</a> 单机部署</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1"></a><a href="#__codelineno-1-1"><span class="linenos" data-linenos="1 "></span></a>mkdir -p /mnt/disk1/juicefs_minio
<a id="__codelineno-1-2" name="__codelineno-1-2"></a><a href="#__codelineno-1-2"><span class="linenos" data-linenos="2 "></span></a>d run -d --name juicefs_minio1 <span class="se">\</span>
<a id="__codelineno-1-3" name="__codelineno-1-3"></a><a href="#__codelineno-1-3"><span class="linenos" data-linenos="3 "></span></a>-p <span class="m">9000</span>:9000 <span class="se">\</span>
<a id="__codelineno-1-4" name="__codelineno-1-4"></a><a href="#__codelineno-1-4"><span class="linenos" data-linenos="4 "></span></a>-p <span class="m">9900</span>:9900 <span class="se">\</span>
<a id="__codelineno-1-5" name="__codelineno-1-5"></a><a href="#__codelineno-1-5"><span class="linenos" data-linenos="5 "></span></a>-v /mnt/disk1/juicefs_minio:/data <span class="se">\</span>
<a id="__codelineno-1-6" name="__codelineno-1-6"></a><a href="#__codelineno-1-6"><span class="linenos" data-linenos="6 "></span></a>--restart always <span class="se">\</span>
<a id="__codelineno-1-7" name="__codelineno-1-7"></a><a href="#__codelineno-1-7"><span class="linenos" data-linenos="7 "></span></a>minio/minio:RELEASE.2021-11-24T23-19-33Z <span class="se">\</span>
<a id="__codelineno-1-8" name="__codelineno-1-8"></a><a href="#__codelineno-1-8"><span class="linenos" data-linenos="8 "></span></a>server /data --console-address <span class="s2">&quot;:9900&quot;</span>
</code></pre></div>
<ul>
<li>访问控制台</li>
</ul>
<p>http://127.0.0.1:9900/dashboard ，默认账号/密码: minioadmin/minioadmin</p>
<h3 id="12-juicefs">1.2 配置 juiceFS<a class="headerlink" href="#12-juicefs" title="Permanent link">&para;</a></h3>
<blockquote>
<p>均在目标集群节点上执行，即客户端。</p>
</blockquote>
<h4 id="121-juicefs">1.2.1 创建 juiceFS 文件系统<a class="headerlink" href="#121-juicefs" title="Permanent link">&para;</a></h4>
<ul>
<li>在创建 JuiceFS 文件系统时，您需要指定用于存储元数据的 <code>Redis</code> 数据库和用于存储实际数据的对象存储。以下命令将创建一个名为 的 <code>JuiceFS</code> 文件系统 <code>pics1</code>，使用 <code>1</code> <code>Redis</code> 中的数据库存储元数据，并使用 <code>pics1</code> <code>MinIO</code> 中创建的存储桶存储实际数据：</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1"></a><a href="#__codelineno-2-1"><span class="linenos" data-linenos=" 1 "></span></a><span class="c1"># 第1个挂载点的存储桶初始化</span>
<a id="__codelineno-2-2" name="__codelineno-2-2"></a><a href="#__codelineno-2-2"><span class="linenos" data-linenos=" 2 "></span></a>juicefs format <span class="se">\</span>
<a id="__codelineno-2-3" name="__codelineno-2-3"></a><a href="#__codelineno-2-3"><span class="linenos" data-linenos=" 3 "></span></a>--storage minio <span class="se">\</span>
<a id="__codelineno-2-4" name="__codelineno-2-4"></a><a href="#__codelineno-2-4"><span class="linenos" data-linenos=" 4 "></span></a>--bucket http://10.65.30.236:9000/pics1 <span class="se">\</span>
<a id="__codelineno-2-5" name="__codelineno-2-5"></a><a href="#__codelineno-2-5"><span class="linenos" data-linenos=" 5 "></span></a>--access-key minioadmin <span class="se">\</span>
<a id="__codelineno-2-6" name="__codelineno-2-6"></a><a href="#__codelineno-2-6"><span class="linenos" data-linenos=" 6 "></span></a>--secret-key minioadmin <span class="se">\</span>
<a id="__codelineno-2-7" name="__codelineno-2-7"></a><a href="#__codelineno-2-7"><span class="linenos" data-linenos=" 7 "></span></a>redis://10.65.30.236:63791/1 <span class="se">\</span>
<a id="__codelineno-2-8" name="__codelineno-2-8"></a><a href="#__codelineno-2-8"><span class="linenos" data-linenos=" 8 "></span></a>pics1
<a id="__codelineno-2-9" name="__codelineno-2-9"></a><a href="#__codelineno-2-9"><span class="linenos" data-linenos=" 9 "></span></a>
<a id="__codelineno-2-10" name="__codelineno-2-10"></a><a href="#__codelineno-2-10"><span class="linenos" data-linenos="10 "></span></a><span class="c1"># 第2个挂载点的存储桶初始化</span>
<a id="__codelineno-2-11" name="__codelineno-2-11"></a><a href="#__codelineno-2-11"><span class="linenos" data-linenos="11 "></span></a>juicefs format <span class="se">\</span>
<a id="__codelineno-2-12" name="__codelineno-2-12"></a><a href="#__codelineno-2-12"><span class="linenos" data-linenos="12 "></span></a>--storage minio <span class="se">\</span>
<a id="__codelineno-2-13" name="__codelineno-2-13"></a><a href="#__codelineno-2-13"><span class="linenos" data-linenos="13 "></span></a>--bucket http://10.65.30.236:9000/pics2 <span class="se">\</span>
<a id="__codelineno-2-14" name="__codelineno-2-14"></a><a href="#__codelineno-2-14"><span class="linenos" data-linenos="14 "></span></a>--access-key minioadmin <span class="se">\</span>
<a id="__codelineno-2-15" name="__codelineno-2-15"></a><a href="#__codelineno-2-15"><span class="linenos" data-linenos="15 "></span></a>--secret-key minioadmin <span class="se">\</span>
<a id="__codelineno-2-16" name="__codelineno-2-16"></a><a href="#__codelineno-2-16"><span class="linenos" data-linenos="16 "></span></a>redis://10.65.30.236:63791/2 <span class="se">\</span>
<a id="__codelineno-2-17" name="__codelineno-2-17"></a><a href="#__codelineno-2-17"><span class="linenos" data-linenos="17 "></span></a>pics2
</code></pre></div>
<ul>
<li>执行该命令后，会看到类似如下的输出，说明<code>JuiceFS</code>文件系统创建成功。</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1"></a><a href="#__codelineno-3-1"><span class="linenos" data-linenos="1 "></span></a>2021/04/29 23:01:18.352256 juicefs[34223] &lt;INFO&gt;: Meta address: redis://10.65.30.236:63791/1
<a id="__codelineno-3-2" name="__codelineno-3-2"></a><a href="#__codelineno-3-2"><span class="linenos" data-linenos="2 "></span></a>2021/04/29 23:01:18.354252 juicefs[34223] &lt;INFO&gt;: Ping redis: 132.185µs
<a id="__codelineno-3-3" name="__codelineno-3-3"></a><a href="#__codelineno-3-3"><span class="linenos" data-linenos="3 "></span></a>2021/04/29 23:01:18.354758 juicefs[34223] &lt;INFO&gt;: Data use minio://10.65.30.236:9000/pics1/pics1/
<a id="__codelineno-3-4" name="__codelineno-3-4"></a><a href="#__codelineno-3-4"><span class="linenos" data-linenos="4 "></span></a>2021/04/29 23:01:18.361674 juicefs[34223] &lt;INFO&gt;: Volume is formatted as {Name:pics UUID:9c0fab76-efd0-43fd-a81e-ae0916e2fc90 Storage:minio Bucket:http://10.65.30.236:9000/pics1 AccessKey:minioadmin SecretKey:removed BlockSize:4096 Compression:none Partitions:0 EncryptKey:}
</code></pre></div>
<ul>
<li>
<p>注：您可以根据需要创建任意数量的 JuiceFS 文件系统。但需要注意的是，每个Redis数据库中只能创建一个文件系统。例如，当你想创建另一个名为 的文件系统时<code>memory</code>，你必须使用<code>Redis</code>中的另一个数据库，例如<code>No.2</code>，即<code>redis://10.65.30.236:63791/2</code>.</p>
</li>
<li>
<p>注：如果不指定<code>--storage</code>选项，JuiceFS 客户端将使用本地磁盘作为数据存储。使用本地存储时，JuiceFS 只能在本地单机上使用，不能被网络中的其他客户端挂载。<a href="https://github.com/juicedata/juicefs/blob/main/docs/en/how_to_setup_object_storage.md#local">单击此处</a>了解详细信息。</p>
</li>
</ul>
<h4 id="122">1.2.2 挂载文件系统<a class="headerlink" href="#122" title="Permanent link">&para;</a></h4>
<ul>
<li><code>JuiceFS</code>文件系统创建完成后，就可以挂载到操作系统上使用了。以下命令将<code>pics</code>文件系统挂载到<code>/mnt/disk1/jfs1</code>和<code>/mnt/disk1/jfs2</code>目录中。</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1"></a><a href="#__codelineno-4-1"><span class="linenos" data-linenos="1 "></span></a><span class="c1"># 第1个挂载点</span>
<a id="__codelineno-4-2" name="__codelineno-4-2"></a><a href="#__codelineno-4-2"><span class="linenos" data-linenos="2 "></span></a>sudo juicefs mount -d redis://10.65.30.236:63791/1 /mnt/disk1/jfs1
<a id="__codelineno-4-3" name="__codelineno-4-3"></a><a href="#__codelineno-4-3"><span class="linenos" data-linenos="3 "></span></a><span class="c1"># 第2个挂载点</span>
<a id="__codelineno-4-4" name="__codelineno-4-4"></a><a href="#__codelineno-4-4"><span class="linenos" data-linenos="4 "></span></a>sudo juicefs mount -d redis://10.65.30.236:63791/2 /mnt/disk1/jfs2
</code></pre></div>
<ul>
<li>执行该命令后，会看到类似如下的输出，说明系统已经成功挂载了 JuiceFS 文件系统。</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1"></a><a href="#__codelineno-5-1"><span class="linenos" data-linenos="1 "></span></a>2021/04/29 23:22:25.838419 juicefs[37999] &lt;INFO&gt;: Meta address: redis://127.0.0.1:6379/1
<a id="__codelineno-5-2" name="__codelineno-5-2"></a><a href="#__codelineno-5-2"><span class="linenos" data-linenos="2 "></span></a>2021/04/29 23:22:25.839184 juicefs[37999] &lt;INFO&gt;: Ping redis: 67.625µs
<a id="__codelineno-5-3" name="__codelineno-5-3"></a><a href="#__codelineno-5-3"><span class="linenos" data-linenos="3 "></span></a>2021/04/29 23:22:25.839399 juicefs[37999] &lt;INFO&gt;: Data use minio://127.0.0.1:9000/pics/pics/
<a id="__codelineno-5-4" name="__codelineno-5-4"></a><a href="#__codelineno-5-4"><span class="linenos" data-linenos="4 "></span></a>2021/04/29 23:22:25.839554 juicefs[37999] &lt;INFO&gt;: Cache: /var/jfsCache/9c0fab76-efd0-43fd-a81e-ae0916e2fc90 capacity: 1024 MB
<a id="__codelineno-5-5" name="__codelineno-5-5"></a><a href="#__codelineno-5-5"><span class="linenos" data-linenos="5 "></span></a>2021/04/29 23:22:26.340509 juicefs[37999] &lt;INFO&gt;: OK, pics is ready at /mnt/disk1/jfs1
</code></pre></div>
<ul>
<li>挂载完成后，就可以访问<code>/mnt/disk1/jfs1</code>和<code>/mnt/disk1/jfs2</code>目录下的文件了。可以执行<code>df</code>命令查看<code>JuiceFS</code>文件系统的挂载状态：</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1"></a><a href="#__codelineno-6-1"><span class="linenos" data-linenos="1 "></span></a>$ df -Th
<a id="__codelineno-6-2" name="__codelineno-6-2"></a><a href="#__codelineno-6-2"><span class="linenos" data-linenos="2 "></span></a>Filesystem     Type          Size    Used   Avail    Use%    Mounted on
<a id="__codelineno-6-3" name="__codelineno-6-3"></a><a href="#__codelineno-6-3"><span class="linenos" data-linenos="3 "></span></a>JuiceFS:pics1   fuse.juicefs  <span class="m">1</span>.0P     64K    <span class="m">1</span>.0P     <span class="m">1</span>%     /mnt/disk1/jfs1
<a id="__codelineno-6-4" name="__codelineno-6-4"></a><a href="#__codelineno-6-4"><span class="linenos" data-linenos="4 "></span></a>JuiceFS:pics2   fuse.juicefs  <span class="m">1</span>.0P     64K    <span class="m">1</span>.0P     <span class="m">1</span>%     /mnt/disk1/jfs2
</code></pre></div>
<ul>
<li>注意：默认情况下，JuiceFS 的缓存位于<code>/var/jfsCache</code>目录中。为了获得该目录的读写权限，<code>sudo</code>这里使用该命令以管理员权限挂载<code>JuiceFS</code>文件系统。普通用户读写时<code>/mnt/disk1/jfs1</code>和<code>/mnt/disk1/jfs2</code>，请为其分配相应的权限。</li>
</ul>
<h4 id="123-juicefs">1.2.3 开机自动挂载 JuiceFS<a class="headerlink" href="#123-juicefs" title="Permanent link">&para;</a></h4>
<ul>
<li>将<code>juicefs</code>客户端重命名为<code>mount.juicefs</code>并将其复制到<code>/sbin/</code>目录中：</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-7-1" name="__codelineno-7-1"></a><a href="#__codelineno-7-1"><span class="linenos" data-linenos="1 "></span></a>sudo cp /usr/local/bin/juicefs /sbin/mount.juicefs
</code></pre></div>
<ul>
<li>
<p>注意：在执行上述命令之前，我们假设<code>juicefs</code>客户端程序已经在<code>/usr/local/bin</code>目录中。也可以<code>juicefs</code>直接从下载的压缩包中解压一份程序，按照上述要求重命名，复制到<code>/sbin/</code>目录下即可。</p>
</li>
<li>
<p>编辑<code>/etc/fstab</code>配置文件，另起一行，按照如下格式添加一条记录：</p>
</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1"></a><a href="#__codelineno-8-1"><span class="linenos" data-linenos="1 "></span></a>&lt;META-URL&gt; &lt;MOUNTPOINT&gt; juicefs _netdev<span class="o">[</span>,&lt;MOUNT-OPTIONS&gt;<span class="o">]</span> <span class="m">0</span> <span class="m">0</span>
</code></pre></div>
<ul>
<li>请<code>&lt;META-URL&gt;</code>以 的格式替换为实际的Redis数据库地址<code>redis://&lt;user&gt;:&lt;password&gt;@&lt;host&gt;:&lt;port&gt;/&lt;db&gt;</code>，例如：<code>redis ://localhost:6379/1</code>。</li>
<li>请替换<code>&lt;MOUNTPOINT&gt;</code>为文件系统的实际挂载点，例如：<code>/jfs</code>.</li>
<li>
<p>如有需要，请替换<code>[,&lt;MOUNT-OPTIONS&gt;]</code>为实际要设置的挂载选项，多个选项用逗号分隔。</p>
</li>
<li>
<p>例如：</p>
</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-9-1" name="__codelineno-9-1"></a><a href="#__codelineno-9-1"><span class="linenos" data-linenos="1 "></span></a>redis://localhost:6379/1 /jfs juicefs _netdev,max-uploads<span class="o">=</span><span class="m">50</span>,writeback,cache-size<span class="o">=</span><span class="m">2048</span> <span class="m">0</span> <span class="m">0</span>
</code></pre></div>
<h4 id="124-juicefs">1.2.4 卸载 juiceFS 文件系统<a class="headerlink" href="#124-juicefs" title="Permanent link">&para;</a></h4>
<ul>
<li>正常卸载</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-10-1" name="__codelineno-10-1"></a><a href="#__codelineno-10-1"><span class="linenos" data-linenos="1 "></span></a>sudo juicefs umount /mnt/disk1/jfs1
</code></pre></div>
<ul>
<li>
<p>提示：执行该<code>juicefs umount -h</code>命令可获取卸载命令的详细帮助信息。</p>
</li>
<li>
<p>卸载失败</p>
</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-11-1" name="__codelineno-11-1"></a><a href="#__codelineno-11-1"><span class="linenos" data-linenos="1 "></span></a>2021-05-09 22:42:55.757097 I | fusermount: failed to unmount /mnt/disk1/jfs1: Device or resource busy
<a id="__codelineno-11-2" name="__codelineno-11-2"></a><a href="#__codelineno-11-2"><span class="linenos" data-linenos="2 "></span></a>exit status 1
</code></pre></div>
<ul>
<li>这可能是因为某些程序正在文件系统中读取和写入文件。为保证数据安全，首先应检查文件系统中有哪些程序在与文件进行交互（例如通过lsof命令），并尝试结束它们之间的交互，然后再次执行卸载命令。</li>
</ul>
<blockquote>
<p>风险提示：以下内容中包含的命令可能会导致文件损坏或丢失，请谨慎使用！</p>
</blockquote>
<p>当然，您也可以在 unmount 命令中添加--forceor-f参数来强制卸载文件系统，但是您必须承担可能带来的灾难性后果：</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-12-1" name="__codelineno-12-1"></a><a href="#__codelineno-12-1"><span class="linenos" data-linenos="1 "></span></a>sudo juicefs umount --force /mnt/disk1/jfs1
</code></pre></div>
<p>您也可以使用以下<code>fusermount</code>命令卸载文件系统：</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-13-1" name="__codelineno-13-1"></a><a href="#__codelineno-13-1"><span class="linenos" data-linenos="1 "></span></a>sudo fusermount -u /mnt/disk1/jfs1
</code></pre></div>

              
            </article>
          </div>
        </div>
        
      </main>
      
        <footer class="md-footer">
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    <script id="__config" type="application/json">{"base": "../../../..", "features": ["search.suggest", "search.highlight", "navigation.tabs", "navigation.expand", "toc.follow", "toc.integrate"], "search": "../../../../assets/javascripts/workers/search.5e67fbfe.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "version": {"default": "latest", "provider": "mike"}}</script>
    
    
      <script src="../../../../assets/javascripts/bundle.c44cc438.min.js"></script>
      
        <script src="../../../../static/js/util.js"></script>
      
    
  </body>
</html>